package com.winona.ui;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.taplinker.client.AppConfigFactory;
import com.taplinker.client.R;
import com.taplinker.client.core.ImageManager;
import com.winona.Base1Activity;
import com.winona.ConstantValue;

public class PerInfoActivity extends Base1Activity {
	private TextView Personal_title;
	private ImageView head;
	private ImageButton back;
	private Intent intent;
	private TextView name, zigezheng, code, position, phone, email, sex;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);

		setContentView(R.layout.perinfo);
		Animation animRef = AnimationUtils.loadAnimation(this, R.anim.anim1);
		findView();
		Personal_title.setText("个人中心");
		setLinstener();
	}

	private void setLinstener() {
		back.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				intent = new Intent(PerInfoActivity.this,
						PersonalSettingActivity.class);
				startActivity(intent);
				overridePendingTransition(R.anim.input, R.anim.out);
			}
		});

	}

	private void findView() {
		Personal_title = (TextView) findViewById(R.id.Personal_title);
		back = (ImageButton) findViewById(R.id.PersonalInfo_back);
		head = (ImageView) findViewById(R.id.per_head);
		name = (TextView) findViewById(R.id.per_name);
		zigezheng = (TextView) findViewById(R.id.per_zigezheng);
		code = (TextView) findViewById(R.id.per_code);
		position = (TextView) findViewById(R.id.per_position);
		phone = (TextView) findViewById(R.id.per_phone);
		email = (TextView) findViewById(R.id.per_email);
		sex = (TextView) findViewById(R.id.per_sex);

		if (!TextUtils.isEmpty(AppConfigFactory.getInstance().getExpert()
				.getHead())) {
			ImageManager.getInstance().loadImage(
					ConstantValue.IMAGE
							+ AppConfigFactory.getInstance().getExpert()
									.getHead(), head, 60, 60, null);
		}

		name.setText(AppConfigFactory.getInstance().getUserInfo().getUserName());
		zigezheng.setText(AppConfigFactory.getInstance().getExpert()
				.getPhysicianCertificate());
		code.setText(AppConfigFactory.getInstance().getExpert()
				.getIdentification());
		position.setText(AppConfigFactory.getInstance().getExpert()
				.getPosition());
		phone.setText(AppConfigFactory.getInstance().getExpert().getPhone());
		email.setText(AppConfigFactory.getInstance().getExpert().getMail());
		sex.setText(AppConfigFactory.getInstance().getExpert().getSexual());

	}
}
